package shoppos;

import java.awt.Panel;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Amin Charolia
 */
public class POSScreen extends javax.swing.JFrame {

    int storeID = 12311;
    int terminalID = 1221;
    /** Creates new form POSScreen */
    DefaultTableModel orderItemModel;
    boolean isDeleteItem;
    boolean isQuantity;
    boolean isPrice;
    OrderItem odItem;
    ArrayList<OrderItem> orderCart;

    public POSScreen() {
        initComponents();
//        DefaultTableModel model = new DefaultTableModel();
//        jTable1.setModel(model);
        jPanel7.setVisible(false);
        jPanel4.setVisible(true);
        jPanel2.setVisible(false);
        jPanel5.setVisible(false);
        jPanel6.setVisible(false);
        jPanel8.setVisible(false);
        PanelCatItem.setVisible(false);
        orderItemModel = (DefaultTableModel) jTable1.getModel();
        orderCart = new ArrayList<OrderItem>();




    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel4 = new javax.swing.JPanel();
        jButton11 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        txtKeyText = new javax.swing.JTextField();
        jButton10 = new javax.swing.JButton();
        btnEnter = new javax.swing.JButton();
        btnClear = new javax.swing.JButton();
        btnBackspace = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        lblCartEdit = new javax.swing.JPanel();
        btnAddToCart = new javax.swing.JButton();
        txtQuantity = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        lblItemName = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtPrice = new javax.swing.JTextField();
        lblStock = new javax.swing.JLabel();
        lblDiscount = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        btnCheckout = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();
        btnSearch = new javax.swing.JButton();
        btnRemove = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        lblTotal = new javax.swing.JLabel();
        lblTotalTax = new javax.swing.JLabel();
        lblTotalAmount = new javax.swing.JLabel();
        lblError = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        btnCreditCard = new javax.swing.JButton();
        btnDebitCard = new javax.swing.JButton();
        btnCreditCard2 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        lblPickUp = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        CategoryPanel = new javax.swing.JPanel();
        btnBackParent = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jbtnCatBack = new javax.swing.JButton();
        CategoryPanel1 = new javax.swing.JPanel();
        PanelCatItem = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tableItem = new javax.swing.JTable();
        btnSelect = new javax.swing.JButton();

        setMinimumSize(new java.awt.Dimension(793, 708));
        setName("POS"); // NOI18N
        setResizable(false);

        jPanel4.setMinimumSize(new java.awt.Dimension(773, 697));
        jPanel4.setName("jPanel4"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(shoppos.ShopPOSApp.class).getContext().getResourceMap(POSScreen.class);
        jButton11.setFont(resourceMap.getFont("btnWelcome.font")); // NOI18N
        jButton11.setText(resourceMap.getString("btnWelcome.text")); // NOI18N
        jButton11.setName("btnWelcome"); // NOI18N
        jButton11.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton11MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGap(167, 167, 167)
                .addComponent(jButton11, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
                .addGap(166, 166, 166))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(179, 179, 179)
                .addComponent(jButton11, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
                .addGap(365, 365, 365))
        );

        jPanel2.setAlignmentX(0.0F);
        jPanel2.setAlignmentY(0.0F);
        jPanel2.setMinimumSize(new java.awt.Dimension(773, 697));
        jPanel2.setName("jPanel2"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setName("jPanel1"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(shoppos.ShopPOSApp.class).getContext().getActionMap(POSScreen.class, this);
        jButton1.setAction(actionMap.get("keyPadButtonClick")); // NOI18N
        jButton1.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton2.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N
        jButton2.setName("jButton2"); // NOI18N
        jButton2.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton3.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton3.setText(resourceMap.getString("jButton3.text")); // NOI18N
        jButton3.setName("jButton3"); // NOI18N
        jButton3.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton4.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N
        jButton4.setName("jButton4"); // NOI18N
        jButton4.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton5.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N
        jButton5.setName("jButton5"); // NOI18N
        jButton5.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton6.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton6.setText(resourceMap.getString("jButton6.text")); // NOI18N
        jButton6.setName("jButton6"); // NOI18N
        jButton6.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton7.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton7.setText(resourceMap.getString("jButton7.text")); // NOI18N
        jButton7.setName("jButton7"); // NOI18N
        jButton7.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton7.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton8.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton8.setText(resourceMap.getString("jButton8.text")); // NOI18N
        jButton8.setName("jButton8"); // NOI18N
        jButton8.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        jButton9.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton9.setText(resourceMap.getString("jButton9.text")); // NOI18N
        jButton9.setName("jButton9"); // NOI18N
        jButton9.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        txtKeyText.setEditable(false);
        txtKeyText.setFont(resourceMap.getFont("txtKeyText.font")); // NOI18N
        txtKeyText.setForeground(resourceMap.getColor("txtKeyText.foreground")); // NOI18N
        txtKeyText.setText(resourceMap.getString("txtKeyText.text")); // NOI18N
        txtKeyText.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        txtKeyText.setName("txtKeyText"); // NOI18N

        jButton10.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        jButton10.setText(resourceMap.getString("jButton10.text")); // NOI18N
        jButton10.setName("jButton10"); // NOI18N
        jButton10.setPreferredSize(new java.awt.Dimension(60, 60));
        jButton10.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MousePressed(evt);
            }
        });

        btnEnter.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        btnEnter.setText(resourceMap.getString("btnEnter.text")); // NOI18N
        btnEnter.setName("btnEnter"); // NOI18N
        btnEnter.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnEnterMouseClicked(evt);
            }
        });

        btnClear.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        btnClear.setText(resourceMap.getString("btnClear.text")); // NOI18N
        btnClear.setName("btnClear"); // NOI18N
        btnClear.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnClearMouseClicked(evt);
            }
        });

        btnBackspace.setFont(resourceMap.getFont("btnEnter.font")); // NOI18N
        btnBackspace.setText(resourceMap.getString("btnBackspace.text")); // NOI18N
        btnBackspace.setName("btnBackspace"); // NOI18N
        btnBackspace.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnBackspaceMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtKeyText, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnBackspace, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnClear, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnEnter, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtKeyText, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(btnEnter, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnBackspace, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                            .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(btnClear, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
                .addContainerGap())
        );

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Item Name", "Quantity", "Price"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setName("table"); // NOI18N
        jTable1.setRowHeight(30);
        jTable1.getTableHeader().setResizingAllowed(false);
        jTable1.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getColumn(0).setResizable(false);
        jTable1.getColumnModel().getColumn(0).setPreferredWidth(200);
        jTable1.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("table.columnModel.title0")); // NOI18N
        jTable1.getColumnModel().getColumn(1).setResizable(false);
        jTable1.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("table.columnModel.title1")); // NOI18N
        jTable1.getColumnModel().getColumn(2).setResizable(false);
        jTable1.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("table.columnModel.title2")); // NOI18N

        lblCartEdit.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        lblCartEdit.setName("lblCartEdit"); // NOI18N

        btnAddToCart.setFont(resourceMap.getFont("btnAddToCart.font")); // NOI18N
        btnAddToCart.setText(resourceMap.getString("btnAddToCart.text")); // NOI18N
        btnAddToCart.setName("btnAddToCart"); // NOI18N
        btnAddToCart.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnAddToCartMouseClicked(evt);
            }
        });

        txtQuantity.setText(resourceMap.getString("txtQuantity.text")); // NOI18N
        txtQuantity.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        txtQuantity.setName("txtQuantity"); // NOI18N
        txtQuantity.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtQuantityMouseClicked(evt);
            }
        });

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        lblItemName.setText(resourceMap.getString("lblItemName.text")); // NOI18N
        lblItemName.setName("lblItemName"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        txtPrice.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        txtPrice.setName("txtPrice"); // NOI18N
        txtPrice.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtPriceMouseClicked(evt);
            }
        });

        lblStock.setText(resourceMap.getString("lblStock.text")); // NOI18N
        lblStock.setName("lblStock"); // NOI18N

        lblDiscount.setText(resourceMap.getString("lblDiscount.text")); // NOI18N
        lblDiscount.setName("lblDiscount"); // NOI18N

        javax.swing.GroupLayout lblCartEditLayout = new javax.swing.GroupLayout(lblCartEdit);
        lblCartEdit.setLayout(lblCartEditLayout);
        lblCartEditLayout.setHorizontalGroup(
            lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(lblCartEditLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblStock, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
                    .addGroup(lblCartEditLayout.createSequentialGroup()
                        .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2))
                        .addGap(10, 10, 10)
                        .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblItemName, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
                            .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(txtQuantity, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(txtPrice, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAddToCart))
                    .addComponent(lblDiscount, javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE))
                .addContainerGap())
        );
        lblCartEditLayout.setVerticalGroup(
            lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(lblCartEditLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(lblItemName))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnAddToCart, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, lblCartEditLayout.createSequentialGroup()
                        .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(lblCartEditLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblStock)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblDiscount)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        jSeparator1.setName("jSeparator1"); // NOI18N

        btnCheckout.setFont(resourceMap.getFont("btnCheckout.font")); // NOI18N
        btnCheckout.setText(resourceMap.getString("btnCheckout.text")); // NOI18N
        btnCheckout.setName("btnCheckout"); // NOI18N
        btnCheckout.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCheckoutMouseClicked(evt);
            }
        });

        btnCancel.setFont(resourceMap.getFont("btnCancel.font")); // NOI18N
        btnCancel.setText(resourceMap.getString("btnCancel.text")); // NOI18N
        btnCancel.setName("btnCancel"); // NOI18N

        btnSearch.setFont(resourceMap.getFont("btnSearch.font")); // NOI18N
        btnSearch.setText(resourceMap.getString("btnSearch.text")); // NOI18N
        btnSearch.setName("btnSearch"); // NOI18N
        btnSearch.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnSearchMouseClicked(evt);
            }
        });

        btnRemove.setFont(resourceMap.getFont("btnRemove.font")); // NOI18N
        btnRemove.setText(resourceMap.getString("btnRemove.text")); // NOI18N
        btnRemove.setName("btnRemove"); // NOI18N
        btnRemove.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnRemoveMouseClicked(evt);
            }
        });

        jPanel3.setBackground(resourceMap.getColor("jPanel3.background")); // NOI18N
        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setName("jPanel3"); // NOI18N

        lblTotal.setBackground(resourceMap.getColor("lblTotal.background")); // NOI18N
        lblTotal.setFont(resourceMap.getFont("lblTotal.font")); // NOI18N
        lblTotal.setForeground(resourceMap.getColor("lblTotal.foreground")); // NOI18N
        lblTotal.setText(resourceMap.getString("lblTotal.text")); // NOI18N
        lblTotal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("lblTotal.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("lblTotal.border.titleFont"))); // NOI18N
        lblTotal.setName("lblTotal"); // NOI18N

        lblTotalTax.setBackground(resourceMap.getColor("lblTotalTax.background")); // NOI18N
        lblTotalTax.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("lblTotalTax.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("lblTotalTax.border.titleFont"))); // NOI18N
        lblTotalTax.setName("lblTotalTax"); // NOI18N

        lblTotalAmount.setFont(resourceMap.getFont("lblTotalAmount.font")); // NOI18N
        lblTotalAmount.setText(resourceMap.getString("lblTotalAmount.text")); // NOI18N
        lblTotalAmount.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("lblTotalAmount.border.title"), javax.swing.border.TitledBorder.RIGHT, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("lblTotalAmount.border.titleFont"))); // NOI18N
        lblTotalAmount.setName("lblTotalAmount"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTotalTax, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblTotalAmount, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(lblTotalAmount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                        .addComponent(lblTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(lblTotalTax, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        lblError.setBackground(resourceMap.getColor("lblError.background")); // NOI18N
        lblError.setFont(resourceMap.getFont("lblError.font")); // NOI18N
        lblError.setText(resourceMap.getString("lblError.text")); // NOI18N
        lblError.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        lblError.setName("lblError"); // NOI18N
        lblError.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 786, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblCartEdit, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblError, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(btnRemove)
                        .addGap(10, 10, 10)
                        .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCheckout, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblError, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane1, 0, 0, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblCartEdit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                            .addComponent(btnCheckout, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE))
                        .addComponent(btnRemove, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnCancel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel5.setMinimumSize(new java.awt.Dimension(773, 697));
        jPanel5.setName("jPanel5"); // NOI18N

        jLabel4.setFont(resourceMap.getFont("jLabel4.font")); // NOI18N
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jLabel4.setName("jLabel4"); // NOI18N

        btnCreditCard.setFont(resourceMap.getFont("btnCreditCard.font")); // NOI18N
        btnCreditCard.setLabel(resourceMap.getString("btnCreditCard.label")); // NOI18N
        btnCreditCard.setName("btnCreditCard"); // NOI18N
        btnCreditCard.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCreditCardMouseClicked(evt);
            }
        });

        btnDebitCard.setFont(resourceMap.getFont("btnDebitCard.font")); // NOI18N
        btnDebitCard.setText(resourceMap.getString("btnDebitCard.text")); // NOI18N
        btnDebitCard.setName("btnDebitCard"); // NOI18N
        btnDebitCard.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnDebitCardMouseClicked(evt);
            }
        });

        btnCreditCard2.setFont(resourceMap.getFont("btnCreditCard2.font")); // NOI18N
        btnCreditCard2.setText(resourceMap.getString("btnCreditCard2.text")); // NOI18N
        btnCreditCard2.setName("btnCreditCard2"); // NOI18N
        btnCreditCard2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCreditCard2MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnCreditCard, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(585, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 786, Short.MAX_VALUE)
                .addContainerGap(10, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnDebitCard, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(585, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnCreditCard2, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(585, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnCreditCard, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnDebitCard, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnCreditCard2, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(37, 37, 37))
        );

        jPanel6.setBackground(resourceMap.getColor("jPanel6.background")); // NOI18N
        jPanel6.setMinimumSize(new java.awt.Dimension(773, 697));
        jPanel6.setName("jPanel6"); // NOI18N

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel5.setName("jLabel5"); // NOI18N

        lblPickUp.setFont(resourceMap.getFont("lblPickUp.font")); // NOI18N
        lblPickUp.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblPickUp.setText(resourceMap.getString("lblPickUp.text")); // NOI18N
        lblPickUp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        lblPickUp.setName("lblPickUp"); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(164, 164, 164)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPickUp, javax.swing.GroupLayout.PREFERRED_SIZE, 432, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 432, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(177, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(216, 216, 216)
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblPickUp, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(305, Short.MAX_VALUE))
        );

        jPanel7.setBackground(resourceMap.getColor("jPanel7.background")); // NOI18N
        jPanel7.setMinimumSize(new java.awt.Dimension(773, 697));
        jPanel7.setName("jPanel7"); // NOI18N

        CategoryPanel.setBackground(resourceMap.getColor("CategoryPanel.background")); // NOI18N
        CategoryPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        CategoryPanel.setAutoscrolls(true);
        CategoryPanel.setMaximumSize(new java.awt.Dimension(753, 2000));
        CategoryPanel.setMinimumSize(new java.awt.Dimension(753, 594));
        CategoryPanel.setName("CategoryPanel"); // NOI18N
        CategoryPanel.setLayout(new java.awt.GridLayout(0, 4));

        btnBackParent.setText(resourceMap.getString("btnBackParent.text")); // NOI18N
        btnBackParent.setName("btnBackParent"); // NOI18N
        btnBackParent.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnBackParentMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap(12, Short.MAX_VALUE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CategoryPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 751, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnBackParent, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CategoryPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 567, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBackParent, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                .addGap(37, 37, 37))
        );

        jPanel8.setBackground(resourceMap.getColor("jPanel8.background")); // NOI18N
        jPanel8.setMinimumSize(new java.awt.Dimension(773, 697));
        jPanel8.setName("jPanel8"); // NOI18N

        jbtnCatBack.setText(resourceMap.getString("jbtnCatBack.text")); // NOI18N
        jbtnCatBack.setActionCommand(resourceMap.getString("jbtnCatBack.actionCommand")); // NOI18N
        jbtnCatBack.setName("jbtnCatBack"); // NOI18N
        jbtnCatBack.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jbtnCatBackMouseClicked(evt);
            }
        });

        CategoryPanel1.setBackground(resourceMap.getColor("CategoryPanel1.background")); // NOI18N
        CategoryPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        CategoryPanel1.setAutoscrolls(true);
        CategoryPanel1.setMaximumSize(new java.awt.Dimension(753, 2000));
        CategoryPanel1.setMinimumSize(new java.awt.Dimension(753, 594));
        CategoryPanel1.setName("CategoryPanel1"); // NOI18N
        CategoryPanel1.setLayout(new java.awt.GridLayout(0, 4));

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jbtnCatBack, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(CategoryPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 751, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CategoryPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 567, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtnCatBack, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                .addGap(37, 37, 37))
        );

        PanelCatItem.setBackground(resourceMap.getColor("PanelCatItem.background")); // NOI18N
        PanelCatItem.setMinimumSize(new java.awt.Dimension(773, 697));
        PanelCatItem.setName("PanelCatItem"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        tableItem.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "UPC", "Name", "Retail Price", "Tax Rate"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableItem.setName("tableItem"); // NOI18N
        tableItem.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(tableItem);
        tableItem.getColumnModel().getColumn(0).setResizable(false);
        tableItem.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("tableItem.columnModel.title0")); // NOI18N
        tableItem.getColumnModel().getColumn(1).setResizable(false);
        tableItem.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("tableItem.columnModel.title1")); // NOI18N
        tableItem.getColumnModel().getColumn(2).setResizable(false);
        tableItem.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("tableItem.columnModel.title2")); // NOI18N
        tableItem.getColumnModel().getColumn(3).setResizable(false);
        tableItem.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("tableItem.columnModel.title3")); // NOI18N

        btnSelect.setText(resourceMap.getString("btnSelect.text")); // NOI18N
        btnSelect.setName("btnSelect"); // NOI18N
        btnSelect.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnSelectMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout PanelCatItemLayout = new javax.swing.GroupLayout(PanelCatItem);
        PanelCatItem.setLayout(PanelCatItemLayout);
        PanelCatItemLayout.setHorizontalGroup(
            PanelCatItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCatItemLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(PanelCatItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 728, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(22, Short.MAX_VALUE))
        );
        PanelCatItemLayout.setVerticalGroup(
            PanelCatItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCatItemLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 541, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(31, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 33, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 20, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(43, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap(33, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 771, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(PanelCatItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(45, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(1629, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 814, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 815, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(1628, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(1, 1, 1)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(1335, Short.MAX_VALUE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(294, 294, 294)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(324, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 324, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(284, 284, 284)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(PanelCatItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(1619, Short.MAX_VALUE)))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void addcategoryPanel(int parentID) {
        ArrayList<POSCategory> arrCat = DBPOS.getCategoryByParent(parentID);

        for (final POSCategory cat : arrCat) {
            JButton j1 = new JButton(cat.categoryName);

            j1.addMouseListener(new java.awt.event.MouseAdapter() {

                @Override
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    categoryBtnClick(evt, cat);
                }
            });

            CategoryPanel.add(j1);

        }

    }

    private void addcategoryPanel1(int parentID) {
        ArrayList<POSCategory> arrCat = DBPOS.getCategoryByParent(parentID);

        for (final POSCategory cat : arrCat) {
            JButton j1 = new JButton(cat.categoryName);

            j1.addMouseListener(new java.awt.event.MouseAdapter() {

                @Override
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    categoryBtnClick2(evt, cat);
                }
            });

            CategoryPanel1.add(j1);

        }

    }

    private void categoryBtnClick(java.awt.event.MouseEvent evt, POSCategory cat) {
        jPanel7.setVisible(false);
        jPanel8.setVisible(true);
        jbtnCatBack.setVisible(true);
        addcategoryPanel1(cat.categoryID);
    }

    private void categoryBtnClick2(java.awt.event.MouseEvent evt, POSCategory cat) {

        jPanel8.setVisible(false);
        jbtnCatBack.setVisible(false);

        PanelCatItem.setVisible(true);
        bindData(cat.categoryID);
    }

    private void bindData(int catID) {
        try {
            ResultSet rs = DBPOS.getItemsWithCategory(storeID, catID);
            // TableModel definition
            DefaultTableModel aModel = (DefaultTableModel) tableItem.getModel();
            // the query
            // Loop through the ResultSet and transfer in the Model
            java.sql.ResultSetMetaData rsmd = rs.getMetaData();
            int colNo = rsmd.getColumnCount();
            while (rs.next()) {
                Object[] objects = new Object[colNo];
                // tanks to umit ozkan for the bug fix!
                for (int i = 0; i < colNo; i++) {
                    objects[i] = rs.getObject(i + 1);
                }
                aModel.addRow(objects);
            }
            tableItem.setModel(aModel);
        } catch (SQLException ex) {
            Logger.getLogger(POSScreen.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    private void jButton1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MousePressed
        // TODO add your handling code here:
        JButton btn = (JButton) evt.getComponent();
        addtextToScreen(btn.getText());

    }//GEN-LAST:event_jButton1MousePressed

    private void btnEnterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnEnterMouseClicked

        if (txtKeyText.getText().length() == 0) {
            return;
        }
        if (isQuantity) {
            txtQuantity.setText(txtKeyText.getText());
            isQuantity = false;
        } else {
            lblError.setText("");
            lblItemName.setText("");
            txtQuantity.setText("");
            txtPrice.setText("");
            lblStock.setText("");
            lblDiscount.setText("");
            odItem = null;

            int UPC = Integer.parseInt(txtKeyText.getText());
            odItem = DBPOS.getItemByCode(UPC, true, storeID);
            if (odItem == null) {
                lblError.setText("Wrong upc code");
            } else {
                lblError.setText("");
                lblItemName.setText(odItem.getItemName());
                txtQuantity.setText(String.valueOf(odItem.getQuantity()));
                txtPrice.setText(odItem.getSellingPrice().toString());
                lblStock.setText("Available stock: " + odItem.getAvailableQuantity());
                if (odItem.getDiscount() != null) {
                    lblDiscount.setText(odItem.getDiscount().toString());
                } else {
                    lblDiscount.setText("No discount for this product");
                }
            }
        }
        txtKeyText.setText("");
    }//GEN-LAST:event_btnEnterMouseClicked

    private void btnClearMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnClearMouseClicked
        // TODO add your handling code here:
        txtKeyText.setText("");
        lblError.setText("");
    }//GEN-LAST:event_btnClearMouseClicked

    private void btnBackspaceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnBackspaceMouseClicked
        // TODO add your handling code here:
        if (txtKeyText.getText().length() > 0) {
            txtKeyText.setText(txtKeyText.getText().substring(0, txtKeyText.getText().length() - 1));
        }
    }//GEN-LAST:event_btnBackspaceMouseClicked

    private void btnAddToCartMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnAddToCartMouseClicked

        if (odItem != null) {

            odItem.setQuantity(Integer.parseInt(txtQuantity.getText()));
            odItem.setSellingPrice(BigDecimal.valueOf(Double.valueOf(txtPrice.getText())).multiply(BigDecimal.valueOf(Double.parseDouble(txtQuantity.getText()))));
            if (odItem.getDiscount() != null) {
                if (odItem.getDiscount().getDiscountType() == 0) {
                    double disPercent = (double) (odItem.getDiscount().getPercentage() / 100);
                    BigDecimal discount = odItem.getSellingPrice().multiply(BigDecimal.valueOf(disPercent));
                    BigDecimal sell = odItem.getSellingPrice().subtract(discount);
                    odItem.setSellingPrice(sell);
                } else {
                    //odItem.setQuantity
                }

            }
            orderItemModel.insertRow(orderCart.size(), new Object[]{odItem.getItemName(), odItem.getQuantity(), odItem.getSellingPrice()});
            orderCart.add(odItem);
            updateTotalPanel();

            lblError.setText("");
            lblItemName.setText("");
            txtQuantity.setText("");
            txtPrice.setText("");
            lblStock.setText("");
            lblDiscount.setText("");
            odItem = null;
        }
    }//GEN-LAST:event_btnAddToCartMouseClicked

    private void txtQuantityMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtQuantityMouseClicked
        txtKeyText.setText(txtQuantity.getText());
        isQuantity = true;
        isPrice = false;
    }//GEN-LAST:event_txtQuantityMouseClicked

    private void btnRemoveMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnRemoveMouseClicked

        if (jTable1.getSelectedRow() != -1) {
            orderCart.remove(jTable1.getSelectedRow());
            orderItemModel.removeRow(jTable1.getSelectedRow());

        }
        updateTotalPanel();
    }//GEN-LAST:event_btnRemoveMouseClicked

    private void txtPriceMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtPriceMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPriceMouseClicked

    private void jButton11MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton11MouseClicked
        jPanel4.setVisible(false);
        jPanel2.setVisible(true);
        jPanel5.setVisible(false);
        jPanel6.setVisible(false);
    }//GEN-LAST:event_jButton11MouseClicked

    private void btnCheckoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCheckoutMouseClicked
        // TODO add your handling code here:
        jPanel2.setVisible(false);
        jPanel4.setVisible(false);
        jPanel5.setVisible(true);
        jPanel6.setVisible(false);
        //DBPOS.purchaseItem(orderCart,storeID, terminalID, 1);
    }//GEN-LAST:event_btnCheckoutMouseClicked

    private void btnCreditCardMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCreditCardMouseClicked
        // TODO add your handling code here:
        int pickUP = DBPOS.purchaseItem(orderCart, storeID, terminalID, 1);
        jPanel6.setVisible(true);
        jPanel5.setVisible(false);
        jPanel2.setVisible(false);
        jPanel4.setVisible(false);
        lblPickUp.setText("your order pickup number is : " + pickUP);
    }//GEN-LAST:event_btnCreditCardMouseClicked

    private void btnDebitCardMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnDebitCardMouseClicked
        // TODO add your handling code here:
        int pickUP = DBPOS.purchaseItem(orderCart, storeID, terminalID, 2);
        jPanel6.setVisible(true);
        jPanel5.setVisible(false);
        jPanel2.setVisible(false);
        jPanel4.setVisible(false);
        lblPickUp.setText("your order pickup number is : " + pickUP);
    }//GEN-LAST:event_btnDebitCardMouseClicked

    private void btnCreditCard2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCreditCard2MouseClicked
        int pickUP = DBPOS.purchaseItem(orderCart, storeID, terminalID, 3);
        jPanel6.setVisible(true);
        jPanel5.setVisible(false);
        jPanel2.setVisible(false);
        jPanel4.setVisible(false);
        lblPickUp.setText("your order pickup number is : " + pickUP);
    }//GEN-LAST:event_btnCreditCard2MouseClicked

    private void jbtnCatBackMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtnCatBackMouseClicked
        // TODO add your handling code here:
        CategoryPanel1.removeAll();
        CategoryPanel1.repaint();
        jPanel8.setVisible(false);
        jbtnCatBack.setVisible(false);
        jPanel7.setVisible(true);
    }//GEN-LAST:event_jbtnCatBackMouseClicked

    private void btnBackParentMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnBackParentMouseClicked
        // TODO add your handling code here:
        CategoryPanel.removeAll();
        jPanel7.setVisible(false);
        jPanel2.setVisible(true);
    }//GEN-LAST:event_btnBackParentMouseClicked

    private void btnSearchMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSearchMouseClicked
        // TODO add your handling code here:
        jPanel2.setVisible(false);
        addcategoryPanel(0);
        jPanel7.setVisible(true);

    }//GEN-LAST:event_btnSearchMouseClicked

    private void btnSelectMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSelectMouseClicked
        if(tableItem.getSelectedRow() != -1){
            int index = tableItem.getSelectedRow();
            int UPC = Integer.parseInt(tableItem.getModel().getValueAt(index, 0).toString());

            odItem = DBPOS.getItemByCode(UPC, true, storeID);

            lblError.setText("");
                lblItemName.setText(odItem.getItemName());
                txtQuantity.setText(String.valueOf(odItem.getQuantity()));
                txtPrice.setText(odItem.getSellingPrice().toString());
                lblStock.setText("Available stock: " + odItem.getAvailableQuantity());
                if (odItem.getDiscount() != null) {
                    lblDiscount.setText(odItem.getDiscount().toString());
                } else {
                    lblDiscount.setText("No discount for this product");
                }
            PanelCatItem.setVisible(false);
            jPanel2.setVisible(true);
        }
        

    }//GEN-LAST:event_btnSelectMouseClicked

    private void addtextToScreen(String text) {
        txtKeyText.setText(txtKeyText.getText() + text);
    }

    private void updateTotalPanel() {
        BigDecimal total = getTotalSum();
        BigDecimal totalTax = getTotalTax();
        BigDecimal grandTotal = total.add(totalTax);
        lblTotal.setText(NumberFormat.getCurrencyInstance().format(total));
        lblTotalTax.setText(NumberFormat.getCurrencyInstance().format(totalTax));
        lblTotalAmount.setText(NumberFormat.getCurrencyInstance().format(grandTotal));

    }

    private BigDecimal getTotalSum() {
        BigDecimal amount = new BigDecimal("0");
        BigDecimal price;
        for (int index = 0; index < orderItemModel.getRowCount(); index++) {
            price = new BigDecimal(orderItemModel.getValueAt(index, 2).toString());
            amount = amount.add(price);
        }

        return amount;
    }

    private BigDecimal getTotalTax() {
        BigDecimal totalTax = new BigDecimal("0");
        double taxPer;
        BigDecimal tax;

        for (int index = 0; index < orderCart.size(); index++) {
            taxPer = orderCart.get(index).getTaxPercentage() / 100;
            tax = orderCart.get(index).getSellingPrice();
            tax = tax.multiply(BigDecimal.valueOf(taxPer));
            totalTax = totalTax.add(tax);
        }

        return totalTax;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel CategoryPanel;
    private javax.swing.JPanel CategoryPanel1;
    private javax.swing.JPanel PanelCatItem;
    private javax.swing.JButton btnAddToCart;
    private javax.swing.JButton btnBackParent;
    private javax.swing.JButton btnBackspace;
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnCheckout;
    private javax.swing.JButton btnClear;
    private javax.swing.JButton btnCreditCard;
    private javax.swing.JButton btnCreditCard2;
    private javax.swing.JButton btnDebitCard;
    private javax.swing.JButton btnEnter;
    private javax.swing.JButton btnRemove;
    private javax.swing.JButton btnSearch;
    private javax.swing.JButton btnSelect;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTable jTable1;
    private javax.swing.JButton jbtnCatBack;
    private javax.swing.JPanel lblCartEdit;
    private javax.swing.JLabel lblDiscount;
    private javax.swing.JLabel lblError;
    private javax.swing.JLabel lblItemName;
    private javax.swing.JLabel lblPickUp;
    private javax.swing.JLabel lblStock;
    private javax.swing.JLabel lblTotal;
    private javax.swing.JLabel lblTotalAmount;
    private javax.swing.JLabel lblTotalTax;
    private javax.swing.JTable tableItem;
    private javax.swing.JTextField txtKeyText;
    private javax.swing.JTextField txtPrice;
    private javax.swing.JTextField txtQuantity;
    // End of variables declaration//GEN-END:variables
}
